<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
	xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
	<meta name="layout" content="main">
	
	<style type="text/css">
	  .form-horizontal .controls {
	margin-left: 60px;
}
	  </style>
</head>
<body>
	<div class="page-header">
		<h1>
			<g:message code="photographer.discount" />
		</h1>
	</div>
	
	<g:if test="${flash.message}">
		<div class="alert alert-success">  
		  <a class="close" data-dismiss="alert">×</a>  
		  <div class="message">${flash.message}</div>  
		</div>  
	</g:if>
	
	<g:hasErrors bean="${priceStratPrice}">
		<g:eachError bean="${priceStratPrice}" var="error">
			<div class="alert alert-error">
				<a class="close" data-dismiss="alert">×</a>
				<g:message error="${error}" />
			</div>
		</g:eachError>
	</g:hasErrors>
	
	<g:hasErrors bean="${priceStratPhotos}">
		<g:eachError bean="${priceStratPhotos}" var="error">
			<div class="alert alert-error">
				<a class="close" data-dismiss="alert">×</a>
				<g:message code="${error}" />
			</div>
		</g:eachError>
	</g:hasErrors>
			
	<g:form class="form-horizontal" controller="photographerDiscount" action="save">
							
		<div class="control-group ">					
			<div class="controls">
				<label class="radio">
					<input type="radio" name="discountType" id="optionNoDiscount" value="1">
					<strong><g:message code="photographer.discounts.noDiscounts" /></strong>
				</label>
			</div>
		</div>				
				
		<div class="control-group ">					
			<div class="controls">	
				<label class="radio">
					<input type="radio" name="discountType" id="optionDiscountAmountPhotos" value="2" >
					<strong><g:message code="photographer.discounts.quantity" /></strong>
				</label>
			</div>
		</div>
				
		<div class="control-group " id="groupDiscountAmountPhotos">
			<div class="controls">			
				<g:message code="photographer.discounts.quantity.msg1" />
				<g:field class="input-small" type="number" id="discountAmountPhotos" name="amountCopies" min="0" maxlength="6" required="" value="${fieldValue(bean: priceStratPhotos, field: 'amountCopies')}"/>  
				<g:message code="photographer.discounts.quantity.msg2" />
				<div class="input-append">
					<g:field max="100" maxlength="3"  class="input-mini" type="number"  id="discountAmountPhotosPercentage" name="discount" min="0" required="" value="${fieldValue(bean: priceStratPhotos, field: 'discount')}"/> %
					<span class="add-on">%</span>
				</div>
			</div>
		</div>
							
		<div class="control-group ">					
			<div class="controls">						
				<label class="radio">
					<input type="radio" name="discountType" id="optionDiscountAmountPrice" value="3">
					<strong><g:message code="photographer.discounts.price" /></strong>										 
				</label>
			</div>
		</div>
				
		<div class="control-group " id="groupDiscountAmountPrice">
			<div class="controls">		
				<g:message code="photographer.discounts.price.msg1" />
				<div class="input-append">
					<g:field class="input-small" type="number" id="discountAmountPrice" name="amountPrice" min="0" maxlength="6" required="" value="${fieldValue(bean: priceStratPrice, field: 'amountPrice')}"/>,
					<span class="add-on">$</span>
				</div>
				<g:message code="photographer.discounts.price.msg2" />
				<div class="input-append">
					<g:field max="100" maxlength="3"  class="input-mini"  type="number" id="discountAmountPricePercentage" name="discount" min="0" required="" value="${fieldValue(bean: priceStratPrice, field: 'discount')}"/> %
					<span class="add-on">%</span>
				</div>
			</div>
		</div>

		<div id="btn-group" class="btn-group">
				<button type="submit" class="btn btn-success">Guardar</button>

			<g:link class="btn btn-success" controller="photographerDiscount"
				action="index">
				<g:message code="cancel" />
			</g:link>
		</div>
	</g:form>
		
		
	<g:render template="discountController" />	
	<script type="text/javascript">
	jQuery(document).ready(function(){																	
		
		var discountController = new PhotographerDiscountController("${currentDiscount}");
							
   	});
	</script>
			
</body>
</html>